package com.hsxc.cdz.monitor.bean.pile.v1_21;

import com.hsxc.cdz.base.util.BytesUtil;

/**
 * 
 * @author 刘力文 充电桩主动上送的心跳报文的实体类
 *
 */
public class HeartPileMsg extends PileMessage {

	private int reserveState; // 预约状态 0为空闲，1为预约状态
	private int chargeState; // 充电状态 0表示空闲，1表示充电
	private int electricity; // 充电电量
	private int sumMoney; // 充电总金额
	private int parkState; // 停车位状态
	private int parkLock; // 车位锁信息
	private String faultCode; // 错误代码

	public static final int CHARGE_STATE_IDLE = 0;
	public static final int CHARGE_STATE_WORK = 1;
	public static final int RESERVE_STATE_IDLE = 0;
	public static final int RESERVE_STATE_WORK = 1;

	public int getReserveState() {
		return reserveState;
	}

	public void setReserveState(int reserveState) {
		this.reserveState = reserveState;
	}

	public int getChargeState() {
		return chargeState;
	}

	public void setChargeState(int chargeState) {
		this.chargeState = chargeState;
	}

	public int getElectricity() {
		return electricity;
	}

	public void setElectricity(int electricity) {
		this.electricity = electricity;
	}

	public int getSumMoney() {
		return sumMoney;
	}

	public void setSumMoney(int sumMoney) {
		this.sumMoney = sumMoney;
	}

	public int getParkState() {
		return parkState;
	}

	public void setParkState(int parkState) {
		this.parkState = parkState;
	}

	public int getParkLock() {
		return parkLock;
	}

	public void setParkLock(int parkLock) {
		this.parkLock = parkLock;
	}

	public String getFaultCode() {
		return faultCode;
	}

	public void setFaultCode(String faultCode) {
		this.faultCode = faultCode;
	}

	@Override
	public void getContentFromByte(byte[] data) {
		byte[] temp;
		temp = BytesUtil.getByte(0, 1, data);
		this.setReserveState(BytesUtil.bytesToIntSeq(temp));

		temp = BytesUtil.getByte(1, 1, data);
		this.setChargeState(BytesUtil.bytesToIntSeq(temp));

		temp = BytesUtil.getByte(2, 4, data);
		this.setElectricity(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(6, 4, data);
		this.setSumMoney(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(10, 1, data);
		this.setParkState(BytesUtil.bytesToIntSeq(temp));

		temp = BytesUtil.getByte(11, 1, data);
		this.setParkLock(BytesUtil.bytesToIntSeq(temp));

		temp = BytesUtil.getByte(12, 1, data);
		this.setFaultCode(BytesUtil.binBytesToStr(temp));
	}

	@Override
	public String toString() {
		return "HeartContent [reserveState=" + reserveState + ", chargeState=" + chargeState + ", electricity="
				+ electricity + ", sumMoney=" + sumMoney + ", parkState=" + parkState + ", parkLock=" + parkLock
				+ ", fault=" + faultCode + ", getreserveState()=" + getReserveState() + ", getChargeState()="
				+ getChargeState() + ", getElectricity()=" + getElectricity() + ", getsumMoney()=" + getSumMoney()
				+ ", getParkState()=" + getParkState() + ", getparkLock()=" + getParkLock() + ", getFault()="
				+ getFaultCode();
	}

}
